using System;
using System.ComponentModel.DataAnnotations.Schema;
using UwinEducation.Shared.Enums;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 订单详情实体
    /// </summary>
    [Table("order_details")]
    public class OrderDetail : EntityBase
    {
        /// <summary>
        /// 详情ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public Guid OrderId { get; set; }

        /// <summary>
        ///学生ID
        /// </summary>

        public Guid StudentId { get; set; }

        /// <summary>
        /// 教师课表ID
        /// </summary>
        public Guid TeacherScheduleId { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        public bool IsForceCheck { get; set; }

        /// <summary>
        /// 订单导航属性
        /// </summary>
        public virtual Order Order { get; set; }
        /// <summary>
        /// 学生导航属性
        /// </summary>
        public virtual Student Student { get; set; }
        /// <summary>
        /// 教师课表导航属性
        /// </summary>
        public virtual TeacherSchedule TeacherSchedule { get; set; }

        /// <summary>
        /// 关联的课程
        /// </summary>
        public virtual List<StudentScheduleDetails> StudentScheduleDetails { get; set; }



        public OrderDetail() { }

        /// <summary>
        /// 创建订单详情
        /// </summary>
        public static OrderDetail Create(
            Guid orderId,
            Guid teacherScheduleId,
            Guid studentId,
            decimal unitPrice,
            bool isForceCheck)
        {
            return new OrderDetail
            {
                Id = Guid.NewGuid(),
                OrderId = orderId,
                StudentId = studentId,
                TeacherScheduleId = teacherScheduleId,
                UnitPrice = unitPrice,
                IsForceCheck = isForceCheck
            };
        }
    }
} 